package com.pzhu.model.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.pzhu.model.help.BaseEntity;
import com.pzhu.model.help.CustomDateTimeSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * @author zengqiuhu
 * @date 2023/7/1 11:37
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserInfoVo extends BaseEntity {

    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空！")
    private String username;

    /**
     * 用户头像
     */
    private String avatar="default.jpg";

    /**
     * 用户邮箱
     */
    @NotBlank(message = "邮箱不能为空！")
    @Email(message = "邮箱格式不正确")
    private String email;

    /**
     * 手机号码
     */
    @NotBlank(message = "手机号码不能为空！")
    private String phone;

    /**
     * 最后登录时间
     */
    @JsonSerialize(using= CustomDateTimeSerializer.class)
    @JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss")
    private Date loginDate;

    /**
     * 所属角色
     */
    private String roles;
}
